﻿using System;

namespace nanoCMS.Core.Extensions {
	public static class NullExtensions {
		public static string IfNullSet(this string value, string newValue) {
			return value ?? newValue;
		}

		public static bool IfNullSet(this bool? value, bool newValue)
		{
			return value ?? newValue;
		}

		public static int IfNullSet(this int? value, int newValue)
		{
			return value ?? newValue;
		}

		public static decimal IfNullSet(this decimal? value, decimal newValue)
		{
			return value ?? newValue;
		}

		public static float IfNullSet(this float? value, float newValue)
		{
			return value ?? newValue;
		}

		public static double IfNullSet(this double? value, double newValue)
		{
			return value ?? newValue;
		}

		public static DateTime IfNullSet(this DateTime? value, DateTime newValue)
		{
			return value ?? newValue;
		}

		public static object IfNullSet(this object value, object newValue)
		{
			return value ?? newValue;
		}
	}
}
